package com.lanchetech.dao;
import java.util.Collection;

import com.lanchetech.bean.vo.FlashSaleSkuVO;import com.lanchetech.entity.FlashSaleSku;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

@Mapper
public interface FlashSaleSkuMapper {
    int deleteByPrimaryKey(Long id);

    int insert(FlashSaleSku record);

    int insertSelective(FlashSaleSku record);

    FlashSaleSku selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(FlashSaleSku record);

    int updateByPrimaryKey(FlashSaleSku record);

    int updateBatch(List<FlashSaleSku> list);

    int updateBatchSelective(List<FlashSaleSku> list);

    int batchInsert(@Param("list") List<FlashSaleSku> list);

    List<FlashSaleSkuVO> findAllByActivityId(@Param("activityId") Long activityId);

    int deleteByActivityIdAndSpuList(@Param("activityId") Long activityId, @Param("list") long[] list);

    List<FlashSaleSku> findListByActivityId(@Param("activityId") Long activityId);

    List<FlashSaleSku> findAllByActivityIdAndSpuId(@Param("activityId") Long activityId, @Param("spuId") Long spuId);

    List<FlashSaleSku> findAllByActivityIdAndSpuIds(@Param("activityId") Long activityId, @Param("spuIds") List<Long> spuIds);

    List<FlashSaleSku> findAllBySpuIdIn(@Param("spuIds")List<Long> spuIds);

    FlashSaleSku findOneByActivityIdAndSkuId(@Param("activityId") Long activityId, @Param("skuId") Long skuId);

    int updateStockAndSalesByActivityIdAndSkuId(@Param("updatedStock")Integer updatedStock,@Param("activityId")Long activityId,@Param("skuId")Long skuId);

    int refundStockAndSalesByActivityIdAndSkuId(@Param("updatedStock")Integer updatedStock,@Param("activityId")Long activityId,@Param("skuId")Long skuId);

    Long sumSpuStock(@Param("spuId") Long spuId, @Param("activityId") Long activityId);

    /**
     * 根据活动ids 获取秒杀sku列表
     * @param activityIds
     * @return
     */
    List<FlashSaleSkuVO> findListByActivityIds(@Param("activityIds") List<Long> activityIds);
}